package com.ocom.mqsimple.controller;

import com.alibaba.fastjson.JSON;
import com.ocom.common.constant.MqSimpleApiUrl;
import com.ocom.common.request.simple.RechargeRequest;
import com.ocom.common.resp.Result;
import com.ocom.common.utils.ResultUtil;
import com.ocom.mqsimple.business.recharge.RechargeProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 充值
 * @Author: 朱晖
 * @Date: 2022/9/12
 **/
@RestController
public class RechargeController {

	@Autowired
	RechargeProductService rechargeProductService;


	@PostMapping(MqSimpleApiUrl.URL_recharge)
	public Result recharge(@RequestBody RechargeRequest rechargeRequest){

		String msg = JSON.toJSONString(rechargeRequest);
		rechargeProductService.handle(msg);

		return ResultUtil.success();

	}

}
